#pragma once
#include <map>
#include <set>
#include "Singleton.h"
#include "expire_def.h"

struct stUser
{
    std::string username;
    std::string agency;
    std::string currency;
    std::int64_t balance;
};

class UserMgr
{
public:
    UserMgr();
    virtual ~UserMgr();

public:
    static UserMgr* Instance()
	{
		return CSingleton<UserMgr>::Instance();
	}

public:
    stUser* GenUser(const std::string& agency, const std::string& currency, std::int64_t balance, const std::string& username = "");

public:
    stUser* Get(const std::string& username);
    bool Update(stUser&& user);
    bool Update(const stUser& user);

private:
    ExpireMgr<std::string, stUser, 3600> m_mgr;
};

static inline std::string UsernameToToken(std::string username)  
{
    return username;
}
static inline std::string TokenToUsername(std::string token)
{
    return token;
}










